package com.twu.biblioteca.utilities;

import java.util.Scanner;

public class ConsoleReader {
    private Scanner scanner;

    public ConsoleReader() {
        this.scanner = new Scanner(System.in);
    }

    public String readFromConsole(String type) {
        System.out.print(String.format("%s :", type));
        return scanner.nextLine();
    }

    public String readIdFromConsole(String type) {
        System.out.println(String.format("Enter %s id", type));
        return scanner.nextLine();
    }

    public int readChoice() {
        System.out.println("Enter your choice");
        int choice = scanner.nextInt();
        scanner.nextLine();//just skip the newline pressed after the int
        return choice;
    }
}
